@svizzle/utils/array-[object-boolean]

Methods

(static) isKeyValue(pair) → {function}

Source:
Since:
  • 0.3.0

Return a predicate expecting an object and returning true if the value at the provided key is the same as the provided value

Example
> isUSA = isKeyValue(['country_id', 'US'])
> isUSA({country_id: 'GB', id: 123})
false
> isUSA({country_id: 'US', id: 456})
true
Parameters:
Name Type Description
pair array

[key, value]

Returns:

predicate - Object -> Boolean

Type
function

(static) isNotKeyValue(pair) → {function}

Source:
Since:
  • 0.3.0

Return a predicate expecting an object and returning true if the value at the provided key is not the same as the provided value

Example
> isNotUSA = isNotKeyValue(['country_id', 'US'])
> isNotUSA({country_id: 'GB', id: 123})
true
> isNotUSA({country_id: 'US', id: 456})
false
Parameters:
Name Type Description
pair array

[key, value]

Returns:

predicate - Object -> Boolean

Type
function

(static) isNotPathValue(pair) → {function}

Source:
Since:
  • 0.3.0

Return a predicate expecting an object and returning true if the value at the provided path is not the same as the provided value

Example
> isNotDefaultStatus = isNotPathValue(['item.status', 'default'])
> isNotDefaultStatus({item: {status: 'active'}, id: 123})
true
> isNotDefaultStatus({item: {status: 'default'}, id: 456})
false
Parameters:
Name Type Description
pair array

[path, value]

Returns:

predicate - Object -> Boolean

Type
function

(static) isPathValue(pair) → {function}

Source:
Since:
  • 0.3.0

Return a predicate expecting an object and returning true if the value at the provided path is the same as the provided value

Example
> isDefaultStatus = isPathValue(['item.status', 'default'])
> isDefaultStatus({item: {status: 'active'}, id: 123})
false
> isDefaultStatus({item: {status: 'default'}, id: 456})
true
Parameters:
Name Type Description
pair array

[path, value]

Returns:

predicate - Object -> Boolean

Type
function